//
//  UserViewController.m
//  必争医疗
//
//  Created by 毕成 on 14-11-19.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "UserViewController.h"
#import "LogViewController.h"
#import "SiteViewController.h"
#import "RegistrateViewController.h"
@interface UserViewController ()

@end

@implementation UserViewController

- (void)dealloc
{

    [super dealloc];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view setBackgroundColor:[UIColor lightGrayColor]];
    self.navigationController.navigationBar.translucent = NO;
    [self.navigationItem setTitle:@"会员中心"];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"应用精品" style:UIBarButtonItemStyleDone target:self action:@selector(logAction:)];
    
    [self creatView];
}

- (void)viewWillAppear:(BOOL)animated
{
    [self.tabBarController.tabBar setHidden:NO];
}

- (void)creatView
{
    //收藏按钮
    UIImageView *collectImage = [[[UIImageView alloc] initWithFrame:CGRectMake(10, 20, 40, 45)] autorelease];
    [collectImage setBackgroundColor:[UIColor whiteColor]];
    [collectImage setImage:[UIImage imageNamed:@"收藏.png"]];
    [self.view addSubview:collectImage];
    UILabel *collectLabel = [[[UILabel alloc] initWithFrame:CGRectMake(collectImage.frame.origin.x + collectImage.frame.size.width, collectImage.frame.origin.y, 275, collectImage.frame.size.height)] autorelease];
    [collectLabel setBackgroundColor:[UIColor whiteColor]];
    [collectLabel setText:@"收藏"];
    collectLabel.font = [UIFont fontWithName:nil size:20];
    collectLabel.textAlignment = NSTextAlignmentLeft;
    [self.view addSubview:collectLabel];
    UIImageView *collectimage = [[[UIImageView alloc] initWithFrame:CGRectMake(collectLabel.frame.origin.x + collectLabel.frame.size.width, collectLabel.frame.origin.y, 40, collectLabel.frame.size.height)] autorelease];
    [collectimage setBackgroundColor:[UIColor whiteColor]];
    [collectimage setImage:[UIImage imageNamed:@"right.png"]];
    [self.view addSubview:collectimage];
    UIButton *collection = [[[UIButton alloc] initWithFrame:CGRectMake(10, 20, 355, 45)] autorelease];
    [collection setBackgroundColor:[UIColor clearColor]];
    [collection addTarget:self action:@selector(collectionAction:) forControlEvents:UIControlEventTouchUpInside];
    //collection.layer.borderWidth = 0.5;
    [self.view addSubview:collection];
    
    //注册按钮
    UIImageView *registrationImage = [[[UIImageView alloc] initWithFrame:CGRectMake(collection.frame.origin.x, collection.frame.origin.y + collection.frame.size.height + 25, 40, 45)] autorelease];
    [registrationImage setBackgroundColor:[UIColor orangeColor]];
    [registrationImage setImage:[UIImage imageNamed:@"注册.png"]];
    [self.view addSubview:registrationImage];
    UILabel *registrationLabel = [[[UILabel alloc] initWithFrame:CGRectMake(registrationImage.frame.origin.x + registrationImage.frame.size.width, registrationImage.frame.origin.y, 130, registrationImage.frame.size.height)] autorelease];
    [registrationLabel setBackgroundColor:[UIColor orangeColor]];
    [registrationLabel setText:@"注册"];
    registrationLabel.font = [UIFont fontWithName:nil size:20];
    registrationLabel.textAlignment = NSTextAlignmentLeft;
    [self.view addSubview:registrationLabel];
    UIButton *registration = [[[UIButton alloc] initWithFrame:CGRectMake(collection.frame.origin.x, collection.frame.origin.y + collection.frame.size.height + 25, 170, 45)] autorelease];
    [registration setBackgroundColor:[UIColor clearColor]];
    [registration addTarget:self action:@selector(registrationAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:registration];
    
    //登录按钮
    UIImageView *logImage = [[[UIImageView alloc] initWithFrame:CGRectMake(registrationLabel.frame.origin.x + registrationLabel.frame.size.width + 15, registrationLabel.frame.origin.y, 40, 45)] autorelease];
    [logImage setBackgroundColor:[UIColor greenColor]];
    [logImage setImage:[UIImage imageNamed:@"登录.png"]];
    [self.view addSubview:logImage];
    UILabel *logLabel = [[[UILabel alloc] initWithFrame:CGRectMake(logImage.frame.origin.x + logImage.frame.size.width, logImage.frame.origin.y, 130, logImage.frame.size.height)] autorelease];
    [logLabel setBackgroundColor:[UIColor greenColor]];
    [logLabel setText:@"登录"];
    logLabel.font = [UIFont fontWithName:nil size:20];
    logLabel.textAlignment = NSTextAlignmentLeft;
    [self.view addSubview:logLabel];
    UIButton *log = [[[UIButton alloc] initWithFrame:CGRectMake(registration.frame.origin.x + registration.frame.size.width + 15, registration.frame.origin.y, registration.frame.size.width, registration.frame.size.height)] autorelease];
    [log setBackgroundColor:[UIColor clearColor]];
    [log addTarget:self action:@selector(logAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:log];
    
    //设置按钮
    UIView *siteView = [[[UIView alloc] initWithFrame:CGRectMake(collection.frame.origin.x, log.frame.origin.y + log.frame.size.height + 45, collection.frame.size.width, collection.frame.size.height)] autorelease];;
    [siteView setBackgroundColor:[UIColor whiteColor]];
    [self.view addSubview:siteView];
    UIImageView *siteImage = [[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 45)] autorelease];
    [siteImage setImage:[UIImage imageNamed:@"设置.png"]];
    [siteView addSubview:siteImage];
    UILabel *siteLabel = [[[UILabel alloc] initWithFrame:CGRectMake(siteImage.frame.origin.x + siteImage.frame.size.width, siteImage.frame.origin.y, 275, siteImage.frame.size.height)] autorelease];
    [siteLabel setText:@"设置"];
    siteLabel.font = [UIFont fontWithName:nil size:20];
    siteLabel.textAlignment = NSTextAlignmentLeft;
    [siteView addSubview:siteLabel];
    UIImageView *siteimage = [[[UIImageView alloc] initWithFrame:CGRectMake(siteLabel.frame.origin.x + siteLabel.frame.size.width, siteLabel.frame.origin.y, 40, 45)] autorelease];
    [siteimage setImage:[UIImage imageNamed:@"right.png"]];
    [siteView addSubview:siteimage];
    UIButton *site = [[[UIButton alloc] initWithFrame:CGRectMake(siteView.frame.origin.x, siteView.frame.origin.y, siteView.frame.size.width, siteView.frame.size.height)] autorelease];
    [site setBackgroundColor:[UIColor clearColor]];
    site.layer.borderWidth = 0.5;
    [site addTarget:self action:@selector(siteAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:site];
    
    //评分按钮
    UIView *scoreView = [[[UIView alloc] initWithFrame:CGRectMake(siteView.frame.origin.x, siteView.frame.origin.y + siteView.frame.size.height, siteView.frame.size.width, siteView.frame.size.height)] autorelease];
    [scoreView setBackgroundColor:[UIColor whiteColor]];
    [self.view addSubview:scoreView];
    UIImageView *scoreImage = [[[UIImageView alloc] initWithFrame:CGRectMake(0,0, 40, 45)] autorelease];
    [scoreImage setImage:[UIImage imageNamed:@"评分.png"]];
    [scoreView addSubview:scoreImage];
    UILabel *scoreLabel = [[[UILabel alloc] initWithFrame:CGRectMake(scoreImage.frame.origin.x + scoreImage.frame.size.width, scoreImage.frame.origin.y, 275, scoreImage.frame.size.height)] autorelease];
    [scoreLabel setText:@"给春雨评分"];
    scoreLabel.font = [UIFont fontWithName:nil size:20];
    scoreLabel.textAlignment = NSTextAlignmentLeft;
    [scoreView addSubview:scoreLabel];
    UIImageView *scoreimage = [[[UIImageView alloc] initWithFrame:CGRectMake(scoreLabel.frame.origin.x + scoreLabel.frame.size.width, scoreLabel.frame.origin.y, 40, scoreLabel.frame.size.height)] autorelease];
    [scoreimage setImage:[UIImage imageNamed:@"right.png"]];
    [scoreView addSubview:scoreimage];
    UIButton *score = [[[UIButton alloc] initWithFrame:CGRectMake(scoreView.frame.origin.x, scoreView.frame.origin.y, scoreView.frame.size.width, scoreView.frame.size.height)] autorelease];
    score.layer.borderWidth = 0.5;
    [score addTarget:self action:@selector(scoreAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:score];
    
    //客服按钮
    UIView *serviceView = [[[UIView alloc] initWithFrame:CGRectMake(scoreView.frame.origin.x, scoreView.frame.origin.y + scoreView.frame.size.height, scoreView.frame.size.width, scoreView.frame.size.height)] autorelease];
    [serviceView setBackgroundColor:[UIColor whiteColor]];
    [self.view addSubview:serviceView];
    UIImageView *serviceImage = [[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 45)] autorelease];
    [serviceImage setImage:[UIImage imageNamed:@"客服.png"]];
    [serviceView addSubview:serviceImage];
    UILabel *serviceLabel = [[[UILabel alloc] initWithFrame:CGRectMake(serviceImage.frame.origin.x + serviceImage.frame.size.width, serviceImage.frame.origin.y, 275, serviceImage.frame.size.height)] autorelease];
    [serviceLabel setText:@"春雨客服"];
    serviceLabel.font = [UIFont fontWithName:nil size:20];
    serviceLabel.textAlignment = NSTextAlignmentLeft;
    [serviceView addSubview:serviceLabel];
    UIImageView *serviceimage = [[[UIImageView alloc] initWithFrame:CGRectMake(serviceLabel.frame.origin.x + serviceLabel.frame.size.width, serviceLabel.frame.origin.y, 40, serviceLabel.frame.size.height)] autorelease];
    [serviceimage setImage:[UIImage imageNamed:@"right.png"]];
    [serviceView addSubview:serviceimage];
    UIButton *service = [[[UIButton alloc] initWithFrame:CGRectMake(serviceView.frame.origin.x, serviceView.frame.origin.y, serviceView.frame.size.width, serviceView.frame.size.height)] autorelease];
    [service setBackgroundColor:[UIColor clearColor]];
    service.layer.borderWidth = 0.5;
    [service addTarget:self action:@selector(serviceAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:service];
    
    //更新按钮
    UIView *updatesView = [[[UIView alloc] initWithFrame:CGRectMake(serviceView.frame.origin.x, serviceView.frame.origin.y + serviceView.frame.size.height, serviceView.frame.size.width, serviceView.frame.size.height)] autorelease];
    [updatesView setBackgroundColor:[UIColor whiteColor]];
    [self.view addSubview:updatesView];
    UIImageView *updatesImage = [[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 45)] autorelease];
    [updatesImage setImage:[UIImage imageNamed:@"更新.png"]];
    [updatesView addSubview:updatesImage];
    UILabel *updatesLabel = [[[UILabel alloc] initWithFrame:CGRectMake(updatesImage.frame.origin.x + updatesImage.frame.size.width, updatesImage.frame.origin.y, 275, updatesImage.frame.size.height)] autorelease];
    [updatesLabel setText:@"检查更新"];
    updatesLabel.font = [UIFont fontWithName:nil size:20];
    updatesLabel.textAlignment = NSTextAlignmentLeft;
    [updatesView addSubview:updatesLabel];
    UIImageView *updatesimage = [[[UIImageView alloc] initWithFrame:CGRectMake(updatesLabel.frame.origin.x + updatesLabel.frame.size.width, updatesLabel.frame.origin.y, 40, updatesLabel.frame.size.height)] autorelease];
    [updatesimage setImage:[UIImage imageNamed:@"right.png"]];
    [updatesView addSubview:updatesimage];
    UIButton *updates = [[[UIButton alloc] initWithFrame:CGRectMake(updatesView.frame.origin.x, updatesView.frame.origin.y, updatesView.frame.size.width, updatesView.frame.size.height)] autorelease];
    [updates setBackgroundColor:[UIColor clearColor]];
    updates.layer.borderWidth = 0.5;
    [updates addTarget:self action:@selector(updatesAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:updates];
    
    //会员按钮
    UIView *memberView = [[[UIView alloc] initWithFrame:CGRectMake(updatesView.frame.origin.x, updatesView.frame.origin.y + updatesView.frame.size.height + 30, updatesView.frame.size.width, updatesView.frame.size.height)] autorelease];
    [memberView setBackgroundColor:[UIColor whiteColor]];
    [self.view addSubview:memberView];
    UIImageView *memberImage = [[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 45)] autorelease];
    [memberImage setBackgroundColor:[UIColor whiteColor]];
    [memberImage setImage:[UIImage imageNamed:@"会员卡.png"]];
    [memberView addSubview:memberImage];
    UILabel *memberLabel = [[[UILabel alloc] initWithFrame:CGRectMake(memberImage.frame.origin.x + memberImage.frame.size.width, memberImage.frame.origin.y, 275, memberImage.frame.size.height)] autorelease];
    [memberLabel setBackgroundColor:[UIColor whiteColor]];
    [memberLabel setText:@"会员卡"];
    memberLabel.font = [UIFont fontWithName:nil size:20];
    memberLabel.textAlignment = NSTextAlignmentLeft;
    [memberView addSubview:memberLabel];
    UIImageView *memberimage = [[[UIImageView alloc] initWithFrame:CGRectMake(memberLabel.frame.origin.x + memberLabel.frame.size.width, memberLabel.frame.origin.y, 40, memberLabel.frame.size.height)] autorelease];
    [memberimage setBackgroundColor:[UIColor whiteColor]];
    [memberimage setImage:[UIImage imageNamed:@"right.png"]];
    [memberView addSubview:memberimage];
    UIButton *member = [[[UIButton alloc] initWithFrame:CGRectMake(memberView.frame.origin.x, memberView.frame.origin.y, memberView.frame.size.width, memberView.frame.size.height)] autorelease];
    [member setBackgroundColor:[UIColor clearColor]];
    [member addTarget:self action:@selector(registrationAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:member];
}

- (void)collectionAction:(id)sender
{
    
}

- (void)registrationAction:(id)sender
{
    RegistrateViewController *registrate = [[RegistrateViewController alloc] init];
    [self.navigationController pushViewController:registrate animated:YES];

}

- (void)logAction:(id)sender
{
    LogViewController *log = [[LogViewController alloc] init];
    [self.navigationController pushViewController:log animated:YES];
}

- (void)siteAction:(id)sender
{
    SiteViewController *site = [[SiteViewController alloc] init];
    [self.navigationController pushViewController:site animated:YES];
}

- (void)scoreAction:(id)sender
{
    
}

- (void)serviceAction:(id)sender
{
    UIAlertView *my = [[UIAlertView alloc] initWithTitle:@"确认" message:@"您确定要拨打：400-001-8855" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
    [my show];
    [my release];
}

- (void)updatesAction:(id)sender
{
    UIAlertView *my = [[UIAlertView alloc] initWithTitle:@"春雨医生更新" message:@"您已经是最新版本" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
    [my show];
    [my release];
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
